<?php require_once '../system/init.php';

$events = new Events();
//$eventsList = $events->getEvents(6, 100, true);

$photos = array();

$photos = $events->getAllPhoto(Common::p('eventId')); 

//shuffle($photos);
//считаем количество показов для каждого события
$events->incrementRocationCountEvent(Common::p('eventId'));
if(!$photos) {
    header('Content-type: application/json');

    echo json_encode(array(
        'photos' => $photos,
        'eventId' => 1 ,
        'photoCount' => false,
        'urls' => $urls
     ));
     die;
}

$photoCount = sizeof($photos); 

 
$photos = array_slice($photos, 0, $photoCount);  // так удаляются id + возможность обрезать

$urls = array() ;

foreach($photos as $photo) {
    $urls[] = $photo['url'] ;
}
     
header('Content-type: application/json');

    echo json_encode(array(
        'photos' => $photos,
        'eventId' => $photos[0]['event_id'] ,
        'photoCount' => $photoCount,
        'urls' => $urls
     ));
     
     